<template>
  <div class="header">
    <div class="main-icon" @click="navTo('/home')">
      <component is="Grid" :style="{width:'20px',height:'20px',marginRight:'4px'}"/>
    </div>
    <div class="header-title">
      {{ title }}
    </div>
    <div class="header-sub">
      {{ subTitle }}
    </div>

    <slot name="navBar">

    </slot>

    <div class="login-out">
      <component is="UserFilled" :style="{width:'20px',height:'20px',marginRight:'4px'}"/>
      退出
    </div>
  </div>
</template>

<script setup>
import router from "@/router/index.js";

const title = import.meta.env.VITE_BASE_TITLE

defineProps(['subTitle'])

const navTo = (path = '/') =>{
  router.push({path:path})
}

</script>

<style scoped lang="scss">
.header {
  color: #ffffff;
  background: rgba(255, 255, 255, .1);
  display: flex;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, .1);

  .main-icon {
    width: 50px;
    height: 50px;
    font-size: 30px;
    background-color: rgba(0, 0, 0, .15);
    box-sizing: border-box;
    color: rgba(255, 255, 255, .5);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .header-title {
    height: 50px;
    line-height: 50px;
    font-size: 26px;
    font-weight: 900;
    padding: 0 40px;
    background: linear-gradient(0deg, #047bf2 0%, #fff 70%, #fff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .header-sub {
    height: 50px;
    line-height: 50px;
    font-size: 22px;
    color: #ffffff;
    padding: 0 40px;
  }



  .login-out {
    height: 50px;
    line-height: 50px;
    font-size: 18px;
    color: #ffffff;
    padding: 0 40px;
    display: flex;
    align-items: center;
    position: absolute;
    right: 0;
    top: 0;
    cursor: pointer;

    &:hover {
      color: #8dc8ff;
    }
  }
}
</style>
